import { createRouter,createWebHashHistory,createWebHistory } from "vue-router";
import MainView from "../views/MainView.vue";
import AboutView from "../views/AboutView.vue";

//路由数组配置
const routes = [
  {
    path: "/:info",
    name: "MainView",
    component: MainView,
  },
  {
    path: "/about/:info",
    name: "AboutView",
    component: AboutView
  },
  {
    path: "/info",
    name: "InfoView",
    redirect: "/info/us", //默认重定向到第一个页面
    component: ()=>import("../views/InformationView.vue"),
    children:[ //二级导航
        {
            path: "company",
            component: ()=>import("../views/aboutsub/AboutCompany.vue"),
        },
        {
            path: "us",
            component: ()=>import("../views/aboutsub/AboutUsView.vue"),
        },
    ]
  }
];

const router = createRouter({
  history: createWebHashHistory(),
  routes: routes,
});

export default router;